-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ESM / CJS interoperability issues with dependencies #34
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 09b8b80 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
d5aa265
to
baa61cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jorenbroekema! I’m not 100% sure if we’ll accept this (it’s not code I’m familiar with so will leave that decision to someone else), but left some queries.
Just for transparency: AFAIK @astrojs/cli-kit
is not really intended to be used outside of Astro, so it could well be that we decide not to accept changes if they don’t resolve issues we are ourselves facing. It might be worth checking out https://github.com/bombshell-dev/clack as an alternative tool.
@@ -100,7 +102,6 @@ async function gradient( | |||
stop() { | |||
done = true; | |||
stdin.removeListener("keypress", keypress); | |||
clearInterval(interval); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed? I’d expect it to be required still.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interval
property was only initialized as let interval: NodeJS.Timeout;
and then never used anywhere.
I'm assuming this was just a leftover of some old code that got removed.
TypeScript was complaining about it, I'm assuming the older version of TypeScript was slightly more lenient on it.
baa61cf
to
09b8b80
Compare
Older versions of:
onetime
restore-cursor
Are CJS-only. These are transitive dependencies caused by
log-update
. Upgrading this one to latest, also ensures the latest versions of the above transitive dependencies are installed, and all of them publish ESM as well in these versions, so that's an easy fix.The other issue is
sisteransi
which is CJS only and does not have an ESM publish, so we can just usecreateRequire
trick to import them in a manner that's compatible with NodeJS out of the box, not requiring build tools / bundlers to handle the interoperability by transforming the module from CJS -> ESM (which is error-prone)